//
//  MKResultTableViewCell.m
//  ManKeCartoon
//
//  Created by dllo on 15/10/23.
//  Copyright © 2015年 ManKe. All rights reserved.
//

#import "MKResultTableViewCell.h"
#import "MKBaseHeader.h"

@implementation MKResultTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH / 5, SCREEN_HEIGHT / 5 - 20)];
        self.titleNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.imgV.frame.size.width+20, 15, SCREEN_WIDTH/2, 30)];
        [self.titleNameLabel setTextColor:[UIColor blackColor]];
        [self.titleNameLabel setFont:[UIFont systemFontOfSize:18]];
        if (SCREEN_HEIGHT != 667) {
            [self.titleNameLabel setFrame:CGRectMake(self.imgV.frame.size.width + 20, 15, SCREEN_WIDTH / 2, 20)];
            [self.titleNameLabel setFont:[UIFont systemFontOfSize:15]];
        }
        self.lastupLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.titleNameLabel.frame.origin.x, self.titleNameLabel.frame.origin.y+35, SCREEN_WIDTH/2., 20)];
        [self.lastupLabel setTextColor:[UIColor grayColor]];
        [self.lastupLabel setFont:[UIFont systemFontOfSize:15]];
        if (SCREEN_HEIGHT != 667) {
            [self.lastupLabel setFrame:CGRectMake(self.titleNameLabel.frame.origin.x, self.titleNameLabel.frame.origin.y + 20, SCREEN_WIDTH / 2, 20)];
        }
        
        self.typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.titleNameLabel.frame.origin.x, self.lastupLabel.frame.size.height + self.lastupLabel.frame.origin.y , SCREEN_WIDTH / 2, 20)];
        [self.typeLabel setTextColor:[UIColor grayColor]];
        [self.typeLabel setFont:[UIFont systemFontOfSize:15]];
        
        self.brief_intrdLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.typeLabel.frame.origin.x, self.typeLabel.frame.size.height + self.typeLabel.frame.origin.y + 5, SCREEN_WIDTH  - SCREEN_WIDTH / 5 - 20, 20)];
        
        if (SCREEN_HEIGHT != 667) {
            [self.brief_intrdLabel setFrame:CGRectMake(self.typeLabel.frame.origin.x, self.typeLabel.frame.size.height + self.typeLabel.frame.origin.y, SCREEN_WIDTH  - SCREEN_WIDTH / 5 - 20, 20)];
        }
        [self.brief_intrdLabel setNumberOfLines:1];
        [self.brief_intrdLabel setTextColor:[UIColor grayColor]];
        [self.brief_intrdLabel setFont:[UIFont systemFontOfSize:15]];
        
        [self.contentView addSubview:self.imgV];
        [self.contentView addSubview:self.titleNameLabel];
        [self.contentView addSubview:self.lastupLabel];
        [self.contentView addSubview:self.typeLabel];
        [self.contentView addSubview:self.brief_intrdLabel];
        
    }
    
    return self;
}

- (void)getDateWithModel:(MKSearchModel *)model{
    
    [self.imgV sd_setImageWithURL:[NSURL URLWithString:model.cover_url]placeholderImage:nil];
    [self.typeLabel setText:model.type];
    [self.lastupLabel setText:[NSString stringWithFormat:@"更新至第%@", model.lastup]];
    [self.brief_intrdLabel setText:model.brief_intrd];
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
